package game;

import java.io.File;

import log.Logger;
import path.PathManager;
public class M5Craft {
	private static final String HOME_ARG = "-homedir=" ;
	private static final String LOCAL_ARG = "-homedir";

	public static void main(String[] args) {  
		try {
			File homePath = null;
			for (String arg : args) {
				if (arg.startsWith(HOME_ARG)) {
					homePath = new File(arg.substring(HOME_ARG.length()));
				} else if (arg.equals(LOCAL_ARG)) {
					homePath = new File("").getAbsoluteFile();
				}
			}
	
			PathManager.getInstance().buildPaths(homePath);
			
			Game3DEngine engine = Game3DEngine.getInstance(); 
			engine.startUp();
			engine.run();
			engine.shutDown();
		} catch (Throwable t) {			
			Logger.error(t, "");
		}
		System.exit(0);
	}

	private M5Craft() {
	}
}
